#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn=5e5+5;
ll ans;
int n,m,d,x[maxn],y[maxn],px[maxn],py[maxn],num[3005][3005];
int vis[3005][3005],dir[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
int main()
{
    //cerr<<1.0*(sizeof(num)+sizeof(vis)+sizeof(x)*4)/1024/1024<<endl;
    freopen("grid.in","r",stdin);
    freopen("grid.out","w",stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    cin>>n>>m>>d;
    n=m=0;
    for(int i=1;i<=d;i++)
    {
        cin>>x[i]>>y[i];
        px[++n]=x[i],py[++m]=y[i],px[++n]=x[i]-1,py[++m]=y[i]-1,px[++n]=x[i]+1,py[++m]=y[i]+1;
    }
    sort(px+1,px+1+n);
    n=unique(px+1,px+1+n)-px-1;
    sort(py+1,py+1+m);
    m=unique(py+1,py+1+m)-py-1;
    queue<pair<int, int> > q;
    for(int i=1;i<=d;i++)
    {
        x[i]=lower_bound(px+1,px+1+n,x[i])-px;
        y[i]=lower_bound(py+1,py+1+n,y[i])-py;
        vis[x[i]][y[i]]=1,q.push(make_pair(x[i],y[i]));
    }
    pair<int, int> pr;
    int tx,ty;
    while(!q.empty())
    {
        pr=q.front();
        q.pop();
        for(int i=0;i<4;i++)
        {
            tx=pr.first+dir[i][0],ty=pr.second+dir[i][1],num[tx][ty]++;
            if(vis[tx][ty]==0 && num[tx][ty]>=2)
            {
                vis[tx][ty]=1;
                q.push(make_pair(tx,ty));
            }
        }
    }
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++) ans+=vis[i][j];
    cout<<ans<<'\n';
    return 0;
}
